/**
 * Author@ Cheng Feitian
 * Date: 2020-3-17
 * Description: 
 * Input Format: 
 * Output Format: 
 */

#include <stdio.h>
#include <ctype.h>

void exProcess(char *cordinate, int *x, int *y);
int isBranket(char c);

int main(void)
{
    /* 初始化 */
    char cordinate[1024] = {0};
    int x = 0, y = 0;
    /* 主逻辑 */
    while (scanf("%s", cordinate) != EOF)
    {
        exProcess(cordinate, &x, &y);
        printf("(%d,%d)\n", x, y);
    }

    return 0;
}

void exProcess(char *cordinate, int *x, int *y)
{
    int flag = 0;
    int temp = 0;
    while (*cordinate != '\0')
    {
        if (isBranket(*cordinate))
        {
            flag = !flag;
            cordinate++;
        }
        if (flag)
        {
            if ((*cordinate == ','))
            {
                if (temp > *x)
                {
                    *x = temp;
                }
                temp = 0;
                cordinate++;
                continue;
            }
            temp = 10 * temp + *cordinate - '0';
        }
        else
        {
            if (temp > *y)
            {
                *y = temp;
            }
            temp = 0;
        }

        cordinate++;
    }
}

int isBranket(char c)
{
    int status;
    if (c == '(' || c == ')')
    {
        status = 1;
    }
    else
        status = 0;
    return status;
}
